<?php

use think\admin\extend\PhinxExtend;
use think\admin\model\SystemConfig;
use think\admin\model\SystemMenu;
use think\admin\model\SystemUser;
use think\admin\service\ProcessService;
use think\helper\Str;
use think\migration\Migrator;

@set_time_limit(0);
@ini_set('memory_limit', -1);

/**
 * 数据安装包
 * @class InstallPackage
 */
class InstallAutoData extends Migrator
{
    /**
     * 数据库初始化
     * @return void
     */
    public function change()
    {
        $this->insertMenu();
    }

    /**
     * 初始化系统菜单
     * @return void
     */
    private function insertMenu()
    {
        PhinxExtend::write2menu([
            [
                'name' => '开发工具',
                'sort' => '0',
                'subs' => [
                    [
                        'name' => '代码生成',
                        'subs' => [
                            ['name' => '控制器生成', 'icon' => 'layui-icon layui-icon-theme', 'node' => 'auto/table/index'],
                        ],
                    ],
                ],
            ],
        ], ['node' => 'auto/table/index']);
    }
}